<template>
  <d2-container>
  	<el-form ref="main-form" :model="form" label-width="80px">
      <el-form-item label="流水单号" size="mini" prop="tradeNos">
        <el-input type="textarea" rows="5" v-model="form.tradeNos"/>
      </el-form-item>
  	</el-form>
		
		<div slot="footer" class="dialog-footer">
      <el-button @click="reset" size="small">取 消</el-button>
      <el-button type="primary" @click="submit" size="small" :loading="loading">提 交</el-button>
    </div>
  </d2-container>
</template>

<script>
import ApiMain from '@/api/trade.detail';
import util from '@/libs/util.js';

export default {
  mixins: [
  ],
  props: [
  ],
  data () {
    return {
    	dialogVisible: false,
    	loading: false,
    	uploadUrl: util.getUploadUrl('tradeorderdetail/handletransstatusfail'),
    	uploadHeaders: util.getUploadHeader(),
    	form: {
    		tradeNos: ''
    	},
    	rules: {
        tradeNos: [
          { required: true, message: '请输入单号', trigger: 'blur' },
        ],
      },
    	file: [],
    }
  },

  mounted () {
  },

  methods: {

  	reset () {
      this.form = {
        tradeNos: '',
      };
    },

  	verifyForm () {
      var bool = true;
      this.$refs['main-form'].validate((valid) => bool = valid);
      return bool;
    },

  	async submit () {
  		if (! this.verifyForm()) return false;

      this.loading = true;

      try {
        await this.submitAdd();
      } finally {
        this.loading = false;
      }
  	},

  	async submitAdd () {
      await ApiMain.handleTransStatusFail(this.form);
      this.$message({message: '操作成功', type: 'success'});
      this.reset();
    },

  }
}
</script>